﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SecureConnection.Packets
{
    public class BasicBuffer
    {
        public byte[] Payload;
        public int Offset;
        public int Size;

        public bool EndOfBuffer { get { return Size == Offset; } }
        public int Left { get { return Size - Offset; } }

        public BasicBuffer()
        {
        }
        ~BasicBuffer()
        {
            Payload = null;
        }

        public virtual void Resize(int length)
        {
            if (Payload == null || Payload.Length != length)
            {
                Payload = null;
                Payload = new byte[length];
            }
            Offset = 0;
            Size = length;
        }
        public virtual void Reset()
        {
            Offset = 0;
        }
    }
}
